<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>部门管理</title>
    <link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/css/style_.css" rel="stylesheet" type="text/css">

    <script>
        function shanchu() {
            // var xg = confirm("是否确定删除这些员工？");
            // if (xg == true) {
            alert("删除成功！！！");
            // } else {
            //     alert("取消删除！！！");
            // }
        }

        function selectAllByChk(chk, checkbox) {
            var size = checkbox.length;
            if (size == null)
                checkbox.checked = chk.checked;
            else {
                for (i = 0; i < checkbox.length; i++) {
                    checkbox[i].checked = chk.checked;
                }
            }
        }
    </script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td height="25" align="center" valign="bottom" class="td06">
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="2%" valign="middle" background="../../images/bg_03.gif">&nbsp;</td>
                        <td width="2%" valign="middle" background="../../images/bg_03.gif"><img
                                src="../../images/main_28.gif" width="9" height="9" align="absmiddle"></td>
                        <td height="30" valign="middle" background="../../images/bg_03.gif">
                            <div align="left"><font color="#FFFFFF">单位员工管理</font></div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table01">
        <tr>
            <td colspan="4" class="td_02"><SPAN class=td_title>员工查询</SPAN></td>
        </tr>
        <form action="${pageContext.request.contextPath}/personnel/selectone" method="post">
            <tr>
                <td width="10%" class="td_02">员工姓名</td>
                <td width="40%" class="td_02"><input name="nickname" value="${users1.nickname}" type="text" class="input" style="width:95% ">
                </td>
                <td width="10%" class="td_02">所属部门</td>
                <td width="40%" class="td_02">
                    <select name="logoncount" size="1" class="box" style="width:95%">
                        <option value="0">--请选择--</option>
                        <c:forEach items="${departments}" var="department">
                            <option value="${department.ID}"
                                    <c:if test="${department.ID == users1.logoncount}">selected</c:if> >${department.depname}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="td_02">职&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;务</td>
                <td class="td_02">
                    <select name="mobile" style="width:95% ">
                        <option value="0" selected>--请选择--</option>
                        <c:forEach items="${user_dutyDaos}" var="user_dutyDao">
                            <option value="${user_dutyDao.ID}"
                                    <c:if test="${user_dutyDao.ID == users1.mobile}">selected</c:if>>${user_dutyDao.name}</option>
                        </c:forEach>
                    </select>
                </td>
                <td class="td_02">&nbsp;</td>
                <td class="td_02"><input name="Submit2" type="submit" class="buttonface02" value=" 查  询 "></td>
            </tr>
        </form>

    </table>
    <br>
    <form method="post" action="${pageContext.request.contextPath}/personnel/deleteUser">
        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td class="td_page">
                    <div align="right">
                        <input name="Submit2" type="button" class="buttonface02" value="新增员工"
                               onClick="location.href='${pageContext.request.contextPath}/personnel/insert'">
                        <input name="Submit2" type="submit" class="buttonface02" value="删除选中的员工"
                               onClick="shanchu()">
                    </div>
                </td>
            </tr>
        </table>
        <table width="95%" border="0" cellpadding="0" cellspacing="0" class="table02" align="center">
            <tr>
                <td height="30" align="right">
                    <div align="left"></div>
                    <c:choose>
                        <c:when test="${users.totalRows==0}">
                            <img src="${pageContext.request.contextPath}/images/1.gif" width="4" height="5"
                                 align="absmiddle">
                            首页&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/2.gif" width="3" height="5"
                                 align="absmiddle">
                            上一页&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/2-2.gif" width="3" height="5"
                                 align="absmiddle">
                            下一页&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/3.gif" width="4" height="5"
                                 align="absmiddle">
                            末页&nbsp;&nbsp;&nbsp; 第1页　　共1页 0 条记录
                        </c:when>
                        <c:when test="${users1.mobile != 0 || users1.logoncount != 0 || (users1.nickname != null && users1.nickname != '')}">
                            <img src="${pageContext.request.contextPath}/images/1.gif" width="4" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/selectone?pagenum=1&nickname=${users1.nickname}&logoncount=${users1.logoncount}&mobile=${users1.mobile}">首页</a>&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/2.gif" width="3" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/selectone?pagenum=${users.pagenum-1>0?users.pagenum-1:1}&nickname=${users1.nickname}&logoncount=${users1.logoncount}&mobile=${users1.mobile}">上一页</a>&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/2-2.gif" width="3" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/selectone?pagenum=${users.pagenum+1<=users.totalPages?users.pagenum+1:users.totalPages}&nickname=${users1.nickname}&logoncount=${users1.logoncount}&mobile=${users1.mobile}">下一页</a>&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/3.gif" width="4" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/selectone?pagenum=${users.totalPages}&nickname=${users1.nickname}&logoncount=${users1.logoncount}&mobile=${users1.mobile}">末页</a>&nbsp;&nbsp;&nbsp; 第${users.pagenum}页　　共 ${users.totalPages} 页 ${users.totalRows} 条记录
                        </c:when>
                        <c:otherwise>
                            <img src="${pageContext.request.contextPath}/images/1.gif" width="4" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/select?pagenum=1">首页</a>&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/2.gif" width="3" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/select?pagenum=${users.pagenum-1>0?users.pagenum-1:1}">上一页</a>&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/2-2.gif" width="3" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/select?pagenum=${users.pagenum+1<=users.totalPages?users.pagenum+1:users.totalPages}">下一页</a>&nbsp;&nbsp;&nbsp;
                            <img src="${pageContext.request.contextPath}/images/3.gif" width="4" height="5"
                                 align="absmiddle">
                            <a href="${pageContext.request.contextPath}/personnel/select?pagenum=${users.totalPages}">末页</a>&nbsp;&nbsp;&nbsp; 第${users.pagenum}页　　共 ${users.totalPages} 页 ${users.totalRows} 条记录
                        </c:otherwise>
                    </c:choose>
                </td>
            </tr>
        </table>
        <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" class="table01">
            <tr>
                <td width="5%" class="td_top"><input name="chk" type="checkbox" id="chk"
                                                     onClick="selectAllByChk(chk,checkbox)" value="checkbox0"></td>
                <td width="10%" class="td_top">用户姓名</td>
                <td width="11%" class="td_top">所属部门</td>
                <td width="13%" class="td_top">职 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;务</td>
                <td width="14%" class="td_top">生日</td>
                <td width="21%" class="td_top">移动电话</td>
                <td width="13%" class="td_top">办公电话</td>
                <td width="13%" class="td_top">修改员工</td>
            </tr>
            <c:forEach items="${users.dates}" var="user">
                <tr>
                    <td class="td_02" height="25"><input type="checkbox" name="checkbox" value="${user.ID}"></td>
                    <td class="td_02"><font color="#000000"><a
                            href="${pageContext.request.contextPath}/personnel/manageuser?id=${user.ID}">${user.nickname}</a></font>
                    </td>
                    <td class="td_02">
                        <c:forEach items="${departments}" var="department">
                            <c:if test="${user.logoncount==department.ID}">
                                ${department.depname}
                            </c:if>
                        </c:forEach>
                    </td>
                    <td class="td_02">
                        <c:forEach items="${user_dutyDaos}" var="user_dutyDao">
                            <c:if test="${user.mobile==user_dutyDao.ID}">
                                ${user_dutyDao.name}
                            </c:if>
                        </c:forEach>
                    </td>
                    <td class="td_02">${user.birthday}</td>
                    <td class="td_02">${user.phone}</td>
                    <td class="td_02">${user.workphone}</td>
                    <td class="td_02"><a href="${pageContext.request.contextPath}/personnel/updateuser?id=${user.ID}">修
                        改</a></td>
                </tr>
            </c:forEach>
        </table>
    </form>
    <p>&nbsp;</p>
</center>
</body>
</html>
